﻿using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace App.WindowsForm
{
    public static class Config
    {
        public static double Opacity { get; set; }
        public static List<string> Codes { get; set; }
        static Config()
        {
            try
            {
                Codes = new List<string>();
                var filePath = AppContext.BaseDirectory + "App.json";
                var lines = File.ReadLines(filePath).ToList();
                for (int i = 1; i < lines.Count(); i++)
                {
                    var line = lines[i];
                    if (string.IsNullOrEmpty(line))
                        break;
                    line = line.Trim();
                    Codes.Add(line);
                }
                Opacity = double.Parse(lines[0]);
            }
            catch (Exception)
            {
                throw new Exception("检查app.json文件");
            }
        }
    }
    public class ConfigModel
    {
        public string code { get; set; }
    }
}
